import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import { resolve } from 'path'

export default defineConfig({
  plugins: [uni()],
  resolve: {
    alias: {
      '@': resolve(__dirname, '.'),
      '@/components': resolve(__dirname, './components'),
      '@/pages': resolve(__dirname, './pages'),
      '@/services': resolve(__dirname, './services'),
      '@/stores': resolve(__dirname, './stores'),
      '@/types': resolve(__dirname, './types'),
      '@/utils': resolve(__dirname, './utils'),
      '@/static': resolve(__dirname, './static')
    }
  },
  server: {
    proxy: {
      '/api': {
        target: 'http://localhost:8085',
        changeOrigin: true,
        rewrite: (path) => path // 保持 /api 前缀
      }
    }
  }
})
